<template>
  <div>
    <el-row>
      <el-col :span="12">
        <el-form-item label="模板名称" prop="name">
          <el-input v-model="form.name" placeholder="请输入" />
        </el-form-item>
      </el-col>
      <!-- <el-col :span="12">
        <el-form-item label="是否周期对比" prop="isCycleContrast">
          <el-checkbox
            v-model="form.isCycleContrast"
            name="isCycleContrast"
            true-label="Y"
            false-label="N"
          />
        </el-form-item>
      </el-col> -->
    </el-row>
    <el-row>
      <el-form-item v-if="form.isCycleContrast==='Y'" label="CRON表达式" prop="cronExpressions">
        <el-input v-model="form.cronExpressions" />
      </el-form-item>
    </el-row>
    <el-row style="margin-bottom: 20px">
      <div style="float: left">
        <el-form-item label="比对场景" prop="contrastScene" style="margin-bottom: 0">
          <el-radio-group v-model="form.contrastScene">
            <el-radio label="today">当天</el-radio>
            <el-radio label="yesterday">昨天</el-radio>
            <el-radio label="endOfLastMonth">上月末</el-radio>
            <el-radio label="full">全表数据</el-radio>
          </el-radio-group>
        </el-form-item>
      </div>
      <div style="float: left;margin: 5px 0 0 20px">
        <span style="color: red">注：以导入的比对清单场景为主</span>
      </div>
    </el-row>
    <!--分割线-->
    <div style="padding: 10px;border-radius: 2px;border: solid 1px blue">
      <div><p :style="{ fontWeight: 'bold' }">第一次比对配置(表结构比对)</p></div>
      <el-form-item label="" style="margin: 10px 0 0 30px">
        <div>
          <el-checkbox v-model="form.isCreateTable" label="是否建表" name="isCreateTable" true-label="Y" false-label="N" />
          <el-checkbox v-model="form.isContrastFieldCount" label="字段总数" name="isContrastFieldCount" true-label="Y" false-label="N" />
          <el-checkbox v-model="form.isContrastFieldName" label="字段名称" name="isContrastFieldName" true-label="Y" false-label="N" />
          <el-checkbox v-model="form.isContrastPartitionField" label="分区字段" name="isContrastPartitionField" true-label="Y" false-label="N" />
        </div>
        <div>
          <el-checkbox v-model="form.isContrastFieldType" label="字段类型" name="isContrastFieldType" true-label="Y" false-label="N" />
          <el-checkbox v-model="form.isContrastFieldLength" label="字段长度" name="isContrastFieldLength" true-label="Y" false-label="N" />
          <el-checkbox v-model="form.isContrastFieldPrecision" label="数值精度" name="isContrastFieldPrecision" true-label="Y" false-label="N" />
          <!-- <el-checkbox v-model="form.isContrastEncoded" label="编码格式" name="isContrastEncoded" true-label="Y" false-label="N" /> -->
        </div>
      </el-form-item>
      <!--分割线-->
      <el-divider />
      <div><p :style="{ fontWeight: 'bold' }">第二次比对配置(数据汇总比对)</p></div>
      <el-form-item label="" style="margin: 10px 0 0 30px">
        <el-checkbox v-model="form.isHasData" label="有无数据" name="isHasData" true-label="Y" false-label="N" />
        <el-checkbox v-model="form.isStatisticsDataCount" label="全表COUNT" name="isStatisticsDataCount" true-label="Y" false-label="N" />
        <el-checkbox v-model="form.isSumCharLength" label="字符length SUM" name="isSumCharLength" true-label="Y" false-label="N" />
        <el-checkbox v-model="form.isSumCharTrimLength" label="字符增加trim length SUM" name="isSumCharTrimLength" true-label="Y" false-label="N" />
        <el-checkbox v-model="form.isMaxCharLength" label="字符length MAX" name="isMaxCharLength" true-label="Y" false-label="N" />
        <el-checkbox v-model="form.isStatisticsNumberSum" label="数值SUM" name="isStatisticsNumberSum" true-label="Y" false-label="N" />
      </el-form-item>
      <!--分割线-->
      <el-divider />
      <div><p :style="{ fontWeight: 'bold' }">第三次比对配置(明细数据比对)</p></div>
      <el-form-item label="" style="margin: 10px 0 10px 30px">
        <div>
          <el-checkbox v-model="form.isAllField" label="全字段明细" name="isAllField" true-label="Y" false-label="N" />
          <el-checkbox v-model="form.isCharNullToEmpty" label="字符NULL转换为空" name="isCharNullToEmpty" true-label="Y" false-label="N" />
          <el-checkbox v-model="form.isNumberNullToZero" label="数值NULL转换为0" name="isNumberNullToZero" true-label="Y" false-label="N" />
        </div>
        <div>
          <el-checkbox v-if="form.isCycleContrast === 'N'" v-model="form.isMaxFaultTolerance" label="比对容错数量" name="isMaxFaultTolerance" true-label="Y" false-label="N" />
          <el-input-number v-if="form.isCycleContrast === 'N' && form.isMaxFaultTolerance==='Y'" v-model="form.maxFaultToleranceNum" :min="1" :max="1000" controls-position="right" style="width:120px;margin-left: 13px" />
        </div>
      </el-form-item>
      <el-form-item label="数据比对方式" prop="dataComparisonType">
        <el-select v-model="form.dataComparisonType" filterable clearable placeholder="请选择">
          <el-option
            v-for="item in dataComparisonTypeList"
            :key="item.key"
            :label="item.typeName"
            :value="item.key"
            :disabled="item.disabled"
          />
        </el-select>
      </el-form-item>
      <!--分割线-->
      <el-divider />
      <div><p :style="{ fontWeight: 'bold' }">数据比对读取方式</p></div>
      <div>
        <el-form-item label="数据量范围（万）" prop="dataExtractScope">
          <el-input-number v-model="form.dataExtractScope" :min="100" :max="1000" :step="100" controls-position="right" style="width:120px;" />
        </el-form-item>
      </div>
      <div>
        <el-form-item>
          <span slot="label" style="width:120px;margin-left: -10px">
            数据量小于等于 {{ form.dataExtractScope }} 万
          </span>
          <el-select v-model="form.lessExtractScopeType" filterable clearable placeholder="请选择">
            <el-option
              v-for="item in dataExtractTypeList"
              :key="item.key"
              :label="item.typeName"
              :value="item.key"
            />
          </el-select>
          <el-input-number v-if="form.lessExtractScopeType === 'CUSTOM'" v-model="form.lessExtractScopeCustom" :min="10" :max="100" :step="10" controls-position="right" style="width:120px;margin-left: 20px" />
        </el-form-item>
      </div>
      <div>
        <el-form-item>
          <span slot="label">
            数据量大于 {{ form.dataExtractScope }} 万
          </span>
          <el-select v-model="form.greaterExtractScopeType" filterable clearable placeholder="请选择">
            <el-option
              v-for="item in dataExtractTypeList"
              :key="item.key"
              :label="item.typeName"
              :value="item.key"
            />
          </el-select>
          <el-input-number v-if="form.greaterExtractScopeType === 'CUSTOM'" v-model="form.greaterExtractScopeCustom" :min="10" :max="100" :step="10" controls-position="right" style="width:120px;margin-left: 20px" />
        </el-form-item>
      </div>

    </div>
  </div>
</template>

<script>
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/expand/data/contrast/template/CRUD.operation.vue'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

export default {
  // eslint-disable-next-line vue/no-unused-components
  components: { crudOperation, rrOperation, udOperation, pagination },
  props: {
    form: {
      required: true,
      type: Object
    }
  },
  data() {
    return {
      detailFlag: false,
      dataComparisonTypeList: [
        { key: 'DETAIL', typeName: '数据直接比对' },
        { key: 'MD5', typeName: '数据MD5加密比对', disabled: true }
      ],
      dataExtractTypeList: [
        { key: 'ALL', typeName: '全量读取' },
        { key: 'CUSTOM', typeName: '分批每次读取量（万）' }
      ]
    }
  },
  methods: {}
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>

</style>
